%h5.prepend-top-0
  已经保护的 (#{@branches.size})
- if @branches.empty?
  %p.settings-message.text-center
    没有保存分支，请在上面选择一个分支保护。
- else
  - can_admin_project = can?(current_user, :admin_project, @project)
  .table-responsive
    %table.table.protected-branches-list
      %colgroup
        %col{ width: "30%" }
        %col{ width: "30%" }
        %col{ width: "25%" }
        - if can_admin_project
          %col
      %thead
        %tr
          %th 分支
          %th 上次提交
          %th 开发者可以推送
          - if can_admin_project
            %th
      %tbody
        - @branches.each do |branch|
          - @url = namespace_project_protected_branch_path(@project.namespace, @project, branch)
          %tr
            %td
              = link_to(branch.name, namespace_project_commits_path(@project.namespace, @project, branch.name))
              - if @project.root_ref?(branch.name)
                %span.label.label-info.prepend-left-5 默认
            %td
              - if commit = branch.commit
                = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id')
                #{time_ago_with_tooltip(commit.committed_date)}
              - else
                (分支已从仓库中删除)
            %td
              = check_box_tag("developers_can_push", branch.id, branch.developers_can_push, data: { url: @url })
            - if can_admin_project
              %td
                = link_to '取消保护', [@project.namespace.becomes(Namespace), @project, branch], data: { confirm: '该分支将允许开发者修改。确定要继续么？' }, method: :delete, class: "btn btn-warning btn-sm"
